package fr.eisti.icc.data;


import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

import javax.persistence.*;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author clion
 */
@Entity
@Table(name="BIBLIOTHEQUE")
@XmlRootElement
public class Bibliotheque implements Serializable {
    
    @OneToMany(cascade = CascadeType.ALL, orphanRemoval = false)  
    @LazyCollection(LazyCollectionOption.FALSE)
    private List<Reservation> reservations;

    @Id
    @Column(name="id")
    private int id;
    @LazyCollection(LazyCollectionOption.FALSE)
    @OneToMany(cascade=CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true)
    private List<Emprunteur> clients;
    @OneToMany(cascade={CascadeType.ALL}, orphanRemoval = true)
    private List<Document> documents;

    private static Bibliotheque instance = null;

    //////////////////////////////////CONSTRUCTEURS//////////////////////////////////

    public Bibliotheque() {
    }

    public Bibliotheque(int id) {
        this.id = id;
    }

   

    //////////////////////////////////GETTERS+SETTERS//////////////////////////////////

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public List<Emprunteur> getClients() {
        return clients;
    }

    public void setClients(List<Emprunteur> clients) {
        this.clients = clients;
    }

    public List<Document> getDocuments() {
        return documents;
    }

    public void setDocuments(List<Document> documents) {
        this.documents = documents;
    }


    //////////////////////////////////fONCTIONS//////////////////////////////////

    public List<Reservation> getReservations() {
        return reservations;
    }

    public void setReservations(List<Reservation> reservations) {
        this.reservations = reservations;
    }
    
    

 
}